<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head> 

 
<link rel="stylesheet" type="text/css"
	href="<s:url value='/css/main.css' />" />
  
 
<title>Test struts2</title>

<script type="text/javascript">

function launchAction() { 
	window.location.replace("actionBienvenue");
}

</script>

</head>
<body>

<!--prend pas le appli context-->
<!--<s:url id="urlID" escapeAmp="false" includeContext="false"/>-->

<s:url id="urlIDS" escapeAmp="false" includeContext="true"/>
 <s:set scope="session" id="varUrlTmp"><s:property value="#urlIDS"/></s:set>
<%
 String urlGot = (String)session.getAttribute("varUrlTmp");
String appContext = getServletContext().getContextPath(); 
 String res = urlGot.replaceAll(appContext,"");
 res = res.substring(1,res.length());
  %>  
<!-- <s:property value="#urlID"/>-->
 valeurURL: <%=urlGot%>
 valeurContext <%=appContext%>
 res <%=res%>
 
  <s:set scope="session" id="varUrl"><%=res%></s:set>
  
<div class="titleDiv"><s:text name="Gestion des entreprises" /></div>

sessionResult:<s:property value="%{#session.varUrl}"/>
   <label onclick="launchAction()">lance action</label>
   
<!--<s:action name="actionBienvenue" executeResult="true" />-->

<table class="borderAll">
	<tr>
		<th><s:text name="entreprise.metier.nom" /></th>
	</tr>
	<s:iterator value="entreprises" status="status">
		<tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>">
			<td class="nowrap"><s:property value="name" /></td>
			<td class="nowrap"><s:url id="edit" action="editEntreprise">
				<s:param name="entreprise.id" value="id" />
			</s:url> <s:a href="%{edit}">Modifier</s:a></td>

			<td class="nowrap"><s:url id="rmv" action="rmvEntreprise">
				<s:param name="entreprise.id" value="id" />
			</s:url> <s:a href="%{rmv}">Supprimer</s:a></td>
		</tr>
	</s:iterator>
</table>

<!--<table>-->
<!--	<tr>-->
<!--		<td align="left" style="font: bold; color: red"><s:fielderror />-->
<!--		<s:actionerror /> <s:actionmessage /></td>-->
<!--	</tr>-->
<!--</table>-->
<br />
<p><s:form action="addOrUpdEntreprise">
	<s:push value="entreprise">
		<s:hidden name="id" />

		<!--		<s:fielderror><s:param value="%{'name'}" /></s:fielderror>-->

		<s:textfield name="name" key="entreprise.metier.nom" />
		<s:submit key="commun.action.ajouter" cssClass="butStnd" />
	</s:push>
</s:form></p>

<br />

<p><s:form action="accesInscriptionUtilisateur"> 
		<s:submit key="accesInscirption" cssClass="butStnd" /> 
</s:form></p>


</body>
</html>